import { defineStore } from "pinia"

const useStore = defineStore("store", {
	// 开启数据缓存
	persist: {
		enabled: true,
		strategies: [
			{
				storage: localStorage,
			},
		],
	},
	state: () => {
		return {
			menuList: [],
			router: {},
		}
	},

	getters: {},

	actions: {
		changeMenu(list) {
			if (list) {
				this.menuList = list
			} else {
				this.menuList.length = 0
			}
		},
		changeRouter(router) {
			if (router) {
				this.router = router
			} else {
				this.router = {}
			}
		},
	},
})

export default useStore
